package com.service.machine;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.primary.machine.MachineBindDeviceRecordInfoMapper;
import com.model.domain.machine.GetMachineBindDeviceRecordInfoDO;
import com.model.pojo.machine.MachineBindDeviceRecordInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author: zql
 * @Description: 农机绑定解定终端相关记录信息服务
 * @Data: 2024-01-04
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class MachineBindDeviceRecordInfoService {

    private final MachineBindDeviceRecordInfoMapper machineBindDeviceRecordInfoMapper;

    public int save(MachineBindDeviceRecordInfo info){
        info.setCreateTime(new Date());
        return machineBindDeviceRecordInfoMapper.insertSelective(info);
    }

    public List<MachineBindDeviceRecordInfo> getPageList(GetMachineBindDeviceRecordInfoDO getMachineBindDeviceRecordInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getMachineBindDeviceRecordInfoDO.getPage(),getMachineBindDeviceRecordInfoDO.getPageSize(),getMachineBindDeviceRecordInfoDO.getSortRow()+getMachineBindDeviceRecordInfoDO.getSortOrder());
        return machineBindDeviceRecordInfoMapper.selectList(getMachineBindDeviceRecordInfoDO);
    }
}
